import { IPSDEUniState } from './ipsdeuni-state';
import { IPSSysUniState } from '../../res/ipssys-uni-state';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEUniStateImpl extends PSModelObjectImpl implements IPSDEUniState {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssysunistate: IPSSysUniState | null = null;

  getPSSysUniState(): IPSSysUniState | null {
    if (this.pssysunistate != null) return this.pssysunistate;
    const value = this.M.getPSSysUniState;
    if (value == null) {
      return null;
    }
    this.pssysunistate = this.getPSModel4('res.IPSSysUniState', value, 'getPSSysUniState') as IPSSysUniState;
    return this.pssysunistate;
  }

  get psSysUniState(): IPSSysUniState | null {
    return this.getPSSysUniState();
  }

  getPSSysUniStateMust(): IPSSysUniState {
    const value = this.getPSSysUniState();
    if (value == null) {
      throw new Error('未指定系统状态协同对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get default(): boolean {
    return this.M.default;
  }

  get cls(): string {
    return 'PSDEUniStateImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.unistate.IPSDEUniState') return true;
    return super.instanceof(cls);
  }
}
